Blockchain technology promises data storage in a decentralized fashion. The data may be stored in a series of data blocks that have precedence relationship between each other, which forms a chain of blocks. The chain of blocks is maintained by a network of nodes, which are also responsible for validating the data before storing it into the blocks. With cryptography and consensus technologies employed by the nodes, the data stored in the blockchain is almost unchangeable. The network of nodes is also referred to as a blockchain consensus network. Recently, the blockchain technology has expanded to provide a framework for execution of blockchain contracts (or referred to as smart contracts). A blockchain contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. For example, blockchain contracts allow the performance of credible transactions without third parties.
Current smart contracts are mostly solidity contracts run on the Ethereum Virtual Machine (EVM), because they are required to be written in solidity language. Solidity contracts are a collection of code (contract functions) and data (contract state) that resides at a specific address on the Ethereum blockchain. Some other smart contracts are native contracts. Native contracts may be written in a language other than solidity. Native contracts should not be confused with pre-compiled contracts. Pre-compiled contracts are reusable functions that run outside the EVM but can be invoked from the EVM. For instance, SHA256, RIPEMD160, and ECRECOVER are implemented as pre-compiled contracts. The native contracts allow programmers to write non-deterministic, infinitely running, and sandbox escaping code. For native contracts, developers are not limited by gas (the execution fee for every operation made on Ethereum) and gas-limit, and the code runs significantly faster than on the EVM. However, current blockchain systems require contracts to be written in solidity and lack adequate support for executing native contracts.